#include <iostream>
#include <queue>
using namespace std;
using ll = long long;
int main() {
    int n, k;
    cin >> n >> k;

    priority_queue<ll, vector<ll>, greater<ll>> q;
    for (int i = 0; i < n; i++) {
        ll t;
        cin >> t;
        q.push(t);
    }
    int sum = 0;
    int cnt = 0;
    while (sum + q.top() <= k) {
        cnt++;
        int t = q.top();
        sum+=t;
        q.pop();
        q.push(t * 2);
    }
    cout << cnt << endl;
    return 0;
}
